package com.lgCore.component;

import com.lgCore.client.NettyClientBootstrap;
import com.lgCore.controller.ClientBootstrap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;


/**
 * 初始化服务 ApplicationContext被初始化后触发监听
 */
@Component
public class InitListener implements CommandLineRunner {

    private static final Logger log = LoggerFactory.getLogger(InitListener.class);

    @Override
    public void run(String... args) throws Exception {
        log.info("初始化服务 start...");
//        //启动rpc客户端
        try {
            NettyClientBootstrap bootstrap = new NettyClientBootstrap(9999,"127.0.0.1");
            ClientBootstrap.bootstrap=bootstrap;
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }


}




